/*
 * @Description:
 * @Version: 1.0
 * @Autor: younghxp
 * @Date: 2022-02-14 15:07:17
 * @LastEditors: younghxp
 * @LastEditTime: 2022-05-16 17:50:08
 */
export default {
  mounted() {
    this.sortTimer = null
    this.filterField &&
      Object.assign(this.filterField, {
        sortField: '', //下划线字段
        sort: '', //升序传ASC，降序传DESC
      })
  },
  methods: {
    sortChange({ column, prop, order }) {
      const _this = this
      const { sortable } = column
      if (sortable === 'custom') {
        if (_this.sortTimer) clearTimeout(_this.sortTimer)
        _this.sortTimer = setTimeout(() => {
          if (order) {
            _this.filterField.sortField = _this.toLine(prop)
            _this.filterField.sort = order === 'ascending' ? 'ASC' : 'DESC'
          } else {
            _this.filterField.sortField = ''
            _this.filterField.sort = ''
          }
          _this.$refs &&
            _this.$refs.pagination &&
            _this.$refs.pagination.getTableListData()
          if (typeof _this.loadTableData === 'function') {
            // 按时段查询=>银行缴存/代发按时段统计
            _this.loadTableData()
          }
        }, 300)
      }
    },
    handleDragend() {
      const _this = this
      _this.$nextTick(() => {
        // setTimeout(function(){
        _this.$refs && _this.$refs.tableBox1 && _this.$refs.tableBox1.doLayout()
        // },0)
      })
    },
  },
}
